home *** CD-ROM | disk | FTP | other *** search
- Path: news.epix.net!usenet
- From: jgvd@epix.net (Jon)
- Newsgroups: comp.lang.c++
- Subject: A simple "find the bug" (please! I need help :)
- Date: 21 Feb 1996 01:06:31 GMT
- Organization: epix.net
- Message-ID: <4gdr6n$6p0@guava.epix.net>
- NNTP-Posting-Host: pclkppp63.epix.net
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.14
-
- I wrote this just now and it's telling me that when i try to cout the
- result at the bottom, it is an undefined value even though I did return
- the result var... See if you can help.
-
- #include <iostream.h>
-
- float num1;
- float num2;
-
- getnums () {
-
- float result = num1 +num2;
-
- cout << "What number?\n";
- cin >> num1;
- cout << "And?\n";
- cin >> num2;
-
- return result;
- }
-
- main (){
-
- getnums ();
-
-
- cout << result;
- }
-
- ^^^^^^ right there is the result i want printed but it does not
- recognize it even though I did try to return the value in the function
- getnums... am I missing something?
-
- Jon
-
-